/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      blockMeshDict.cylinder;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

// The cylinder blocks are designed to surround the valve
// modules generated separately.

// 0 _  _ 1     8 _  _ 9    16 _  _ 17
// |      |     |      |     |      |
// |      |     |      |     |      |
// 2 _  _ 3    10 _  _ 11   18 _  _ 19

pistonPos -4;
nPiston 8;

x0a -13;
x1a -11;

x0b -1;
x1b 1;

x0c 11;
x1c 13;

y0 0;
y1 $pistonPos;

z0 0.0;
z1 0.5;

vertices
(
    ($x0a 0.0 $z0) //0
    ($x1a 0.0 $z0) //1
    ($x0a $y1 $z0) //2
    ($x1a $y1 $z0) //3

    // + 4
    ($x0a 0.0 $z1) //0
    ($x1a 0.0 $z1) //1
    ($x0a $y1 $z1) //2
    ($x1a $y1 $z1) //3

    // + 8
    ($x0b 0.0 $z0) //0
    ($x1b 0.0 $z0) //1
    ($x0b $y1 $z0) //2
    ($x1b $y1 $z0) //3

    // + 12
    ($x0b 0.0 $z1) //0
    ($x1b 0.0 $z1) //1
    ($x0b $y1 $z1) //2
    ($x1b $y1 $z1) //3

    // + 16
    ($x0c 0.0 $z0) //0
    ($x1c 0.0 $z0) //1
    ($x0c $y1 $z0) //2
    ($x1c $y1 $z0) //3

    // + 20
    ($x0c 0.0 $z1) //0
    ($x1c 0.0 $z1) //1
    ($x0c $y1 $z1) //2
    ($x1c $y1 $z1) //3
);

blocks
(
    hex (0 2 3 1 4 6 7 5) ($nPiston 6 1) simpleGrading (1 1 1)
    hex (8 10 11 9 12 14 15 13) ($nPiston 6 1) simpleGrading (1 1 1)
    hex (16 18 19 17 20 22 23 21) ($nPiston 6 1) simpleGrading (1 1 1)
);

defaultPatch
{
    name    frontAndBack;
    type    empty;
}

boundary
(
    nonCoupleFluidLiner
    {
        type    wall;
        inGroups    (NCMWbase);
        faces
        (
            (2 0 4 6)
            (19 23 21 17)
        );
    }

    fluid_TO_piston
    {
        type    mappedWall;
        inGroups    (mappedWalls);
        neighbourPatch  piston_TO_fluid;
        neighbourRegion piston;
        matchTolerance  0.01;
        method  intersection;
        faces
        (
            (3 2 6 7)
            (11 10 14 15)
            (19 18 22 23)
        );
    }

    fluid_TO_cylinderHead
    {
        type    mappedWall;
        inGroups    (mappedWalls);
        neighbourPatch cylinderHead_TO_fluid;
        neighbourRegion cylinderHead;
        method  intersection;
        faces
        (
            (0 1 5 4)
            (8 9 13 12)
            (16 17 21 20)
        );
    }

    nonCouple_cyl_ev
    {
        type    patch;
        faces
        (
            (3 7 5 1)
            (10 8 12 14)
        );
    }

    nonCouple_cyl_iv
    {
        type    patch;
        faces
        (
            (18 16 20 22)
            (11 15 13 9)
        );
    }
);

// ************************************************************************* //
